package coc.example.script.crawler;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import coc.core.Crawler;
import coc.core.CrawlerConfig;
import coc.core.SpiderResult;
import coc.core.url.Url;

public class BaseCrawler extends Crawler {
	protected Logger log = LoggerFactory.getLogger(getClass());

	public BaseCrawler(CrawlerConfig config) {
		super(config);
	}

	@Override
	protected List<Url> filterUrls(String taskId, List<Url> suspendUrls) {
		return suspendUrls;
	}

	@Override
	protected Integer saveSpiderResult(SpiderResult spiderResult) {
		log.debug("-------------------------------------------------------------------------------------------------");
		log.debug(spiderResult.getData().toString());
		log.debug("-------------------------------------------------------------------------------------------------");
		return spiderResult.getDataSize();
	}

	@Override
	protected void complete() {
		log.debug(result.toString());
	}
}
